/*
 * http://www.digione.cn
 */
package com.jqd.examples.struts2;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.jqd.examples.struts2.model.Person;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

/**
 * TODO
 * 
 * @author liaozc@digione.cn
 * @date 2012-8-9
 * @since 1.0
 */
public class TestAction extends ActionSupport {
	
	private static final long serialVersionUID = -20795423595357532L;
	
	private String username;
	
	private Person person;
	
	
	public String test1() {
		ActionContext.getContext().put("actionContextRequest", "requestScope");
		ActionContext.getContext().getSession().put("actionContextSession", "sessionScope");
		ActionContext.getContext().getApplication()
				.put("actionContextApplication", "applicationScope");
		
		HttpServletRequest request = ServletActionContext.getRequest();
		System.out.println(request.getParameter("actionContextRequest"));
		
		
		System.out.println(person);
		if (username.equals("zhangsan")) {
			return "result1";
		}
		return "result2";
	}
	
	
	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}
	
	
	/**
	 * @param username
	 *            the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}
	
	
	/**
	 * @return the person
	 */
	public Person getPerson() {
		return person;
	}
	
	
	/**
	 * @param person
	 *            the person to set
	 */
	public void setPerson(Person person) {
		this.person = person;
	}
	
}
